package com.ssfGame.puremvc.view.module 
{
	
	import api.event.CustomEvent;
	
	import com.game.baseMc.BaseMc;
	import com.game.tips.TipCtrl;
	import com.game.utils.SwfManager;
	
	import flash.display.DisplayObject;
	import flash.display.DisplayObjectContainer;
	
	/**
	 * 
	 * @author zengly
	 */
	public class ModuleVC extends BaseMc
	{
		//自定义事件名称
		
		public static const TO_MEDIATOR:String="to_mediator";//向mediator发送事件
		public static const CLOSE:String="close";//发送"关闭"
		
		
		protected var _swfManager:SwfManager=SwfManager.getInstance();//外部载入的swf管理
		protected var _tipCtlr:TipCtrl=TipCtrl.getInstance();
		private var _disList:Array=[];//显示对象列表
		public function ModuleVC()
		{
			
		}
		public function gcVC():void{
			delAllDis();
			gcBaseMc();
			
		}
		/**
		 * 发送自定义事件
		 * @param type 类型
		 * @param data 数据
		 */
		protected function sendToMediator(type:String=null,data:Object=null):void
		{
			dispatchEvent(new CustomEvent(TO_MEDIATOR,data,type));
		}
		
		/**
		 * 添加显示对象
		 * @param disObj 
		 */
		protected function addDis(disObj:DisplayObject):void{
			_disList.push(disObj);
			this.addChild(disObj);
		}
		/**
		 * 删除所有显示对象
		 */
		protected function delAllDis():void{
			for(var i:uint=0;i<_disList.length;i++){
				if(_disList[i]==null){
					return;
				}
				if(this.contains(_disList[i])){
					removeChild(_disList[i]);
				}
			}
			_disList=[];
		}
	}
}